package com.pickup.service.impl;

import com.pickup.aspect.LogMessage;
import com.pickup.service.LogService;
import com.pickup.utils.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;

@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public void saveLog(String logMessage) {
        LogMessage log = JsonUtils.jsonToPojo(logMessage, LogMessage.class);

        mongoTemplate.save(log);
    }
}
